#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main(void)
{
	int a = 0;
	int b =0 ;
	int result = 0;
	scanf("%x %o", &a, &b);
	result = a + b;
	printf("%d", result);
	return 0;
}